package com.example.Lezedata.util;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import com.example.Lezedata.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class CGHUDView extends FrameLayout {
    ProgressBar progressBar;
    private ViewGroup viewGroup;
    public CGHUDView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public static CGHUDView showInView(Context context, ViewGroup parentView) {
        CGHUDView fragment = (CGHUDView)LayoutInflater.from(context).inflate(R.layout.hud,parentView,false);
        fragment.viewGroup = parentView;
        parentView.addView(fragment);
        return fragment;
    }

    public void dismiss(){
        this.clearAnimation();
        viewGroup.removeView(this);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        progressBar = findViewById(R.id.progressBar);
        progressBar.animate();
    }
}